<?php

/* @var $this yii\web\View */

use yii\helpers\Html;
use yii\widgets\ActiveForm;

$this->title = ($this->context->curUserIsAdmin)?'修改会员密码':'修改登录密码';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="page-title">
  <div>
    <h1><i class="fa fa-key"></i> <?=($this->context->curUserIsAdmin)?'修改会员密码':'修改登录密码'?></h1>
    <ul class="breadcrumb side">
      <li><i class="fa fa-home fa-lg"></i></li>
      <li><a href="#"><?=($this->context->curUserIsAdmin)?'会员管理':'账户管理'?></a></li>
      <li class='active'><a href="#"><?=($this->context->curUserIsAdmin)?'修改会员密码':'修改登录密码'?></a></li>
    </ul>
  </div>

</div>
<div class="card">
  <?php $form = ActiveForm::begin(); ?>

  <?php
    if(isset($tip)&&$tip===true){
      if($model->hasErrors()){
  ?>
        <div class="alert alert-danger" role="alert">
          <?php
              foreach($model->getErrors("") as $key=>$value){
                echo $value."<br>";
              }
          ?>
        </div>
  <?php
      }else{
  ?>
        <div class="alert alert-success" role="alert">改密码成功！</div>
  <?php
      }
    }
  ?>
  <?php
  if($this->context->curUserIsAdmin){
    echo $form->field($model, 'name');
    echo $form->field($model, 'new_pw')->passwordInput();
  }else{
    echo $form->field($model, 'new_pw')->passwordInput()->hint('您将修改登录密码，修改后谨记自己密码，切勿透露给他人，否则一切损失自己负责！');
  }
   ?>
  <div class="form-group">
      <?= Html::submitButton('提交', ['class' => 'btn btn-warning']) ?>
  </div>
  <?php ActiveForm::end(); ?>
</div>
